#ifndef FKABSTRACTOBJECTMANAGER_H
#define FKABSTRACTOBJECTMANAGER_H

#include <QObject>
#include <QVariant>

#include "fkobjects_global.h"

class FKEvent;
class FKClient;
class FKClientManager;

class FKOBJECTSSHARED_EXPORT FKAbstractObjectManager:public QObject{
    Q_OBJECT
public:
    FKAbstractObjectManager();
    ~FKAbstractObjectManager();
    FKClient* getLocalClient();
    void reset(){}
    void setServerFiles(QVariant lst){_serverFiles=lst;}
    QVariant serverFiles() const{return _serverFiles;}
public slots:
    void setLocalClient(FKClient* client);
private slots:
    virtual void action(FKEvent* action);
    virtual void internalEvent(FKEvent* event);
    virtual void externalEvent(FKEvent* event);
    virtual void clientRequested(QString clientName, QString password);
    void genClient(QString clientName, QString password);
    virtual void genClient(QString clientName, QString password, QVariant validator);
    virtual void sendMessage(QString message, FKClientManager* manager);
signals:
    void message(QString m);
    void clientSetted(FKClient* client);
protected slots:
    void genClient(QString clientName, QString password, QVariant validator, FKClientManager* s);
    void showMessage(QString text);
protected:
    virtual bool validateClientData(QString clientName, QString password);
    QString checkClient(QString clientName, QString password);
    FKClient* catchClient(QString clientName, QString password);
    virtual QString clientGeneration(QString clientName, QString password, QVariant validator);
//    FKClient* createClient(FKEvent* client);
private:
    virtual void returnMessage(qint32 clientID, QString text)=0;
    virtual bool regClient(QString clientName, QString password, QVariant validator);
    virtual void getClient(QString clientName, QString password, FKClientManager* s)=0;
    QMap<QString, QVariant> staticInitClients();
    QMap<QString, QVariant> _clientAccs;
//    QThread* _thread;
    FKClient* _client;
    QVariant _serverFiles;
};

#endif // FKABSTRACTOBJECTMANAGER_H
